package com.c.dto;

import java.util.List;
import java.util.Map;

public class PageDto {
	private Integer start;
	private Integer limit;
	private Integer page;
	private Integer rows;
	private Boolean fuzzy;
	// 排序的字段名称
	private List<String> sort;
	// 排序动作 ASC 还是 DESC
	private List<String> order;
	// 排序 [{field:desc},{field:asc}]
	private Map<String, String> sortMap;

	public Integer getStart() {
		if (this.start != null) {
			return this.start;
		} else if (this.page != null && this.rows != null) {
			return (this.page - 1) * rows;
		} else {
			return null;
		}
	}

	public void setStart(Integer start) {
		this.start = start;
	}

	public Integer getLimit() {
		if (this.limit != null) {
			return this.limit;
		} else if (this.rows != null) {
			return this.rows;
		} else {
			return null;
		}
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Boolean getFuzzy() {
		if (this.fuzzy != null) {
			return this.fuzzy;
		} else {
			return false;
		}
	}

	public Map<String, String> getSortMap() {
		return sortMap;
	}

	public void setSortMap(Map<String, String> sortMap) {
		this.sortMap = sortMap;
	}

	public void setFuzzy(Boolean fuzzy) {
		this.fuzzy = fuzzy;
	}

	public List<String> getSort() {
		return sort;
	}

	public void setSort(List<String> sort) {
		this.sort = sort;
	}

	public List<String> getOrder() {
		return order;
	}

	public void setOrder(List<String> order) {
		this.order = order;
	}

}
